package com.isdepci.project.carbon.service.impl;

import java.util.ArrayList;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.isdepci.project.carbon.mapper.ProductCarbonStageMapper;
import com.isdepci.project.carbon.domain.ProductCarbonStage;
import com.isdepci.project.carbon.service.IProductCarbonStageService;

/**
 * 产品碳足迹-产品阶段Service业务层处理
 *
 * @author isdepci
 * @date 2024-11-11
 */
@Service
public class ProductCarbonStageServiceImpl implements IProductCarbonStageService
{
    @Autowired
    private ProductCarbonStageMapper productCarbonStageMapper;

    @Override
    public List<Long> selectStageIdsByStageId(Long stageId) {
        //当前阶段或环节底下的子阶段子环节
        List<Long> ids = productCarbonStageMapper.selectStageIdsById(stageId);
        if(ids.size()<=0){
            return new ArrayList<>();
        }
        return productCarbonStageMapper.selectStageIdsByStandardStagyIds(ids);
    }

    /**
     * 查询产品碳足迹-产品阶段
     */
    @Override
    public ProductCarbonStage selectProductCarbonStageById(Long id)
    {
        return productCarbonStageMapper.selectProductCarbonStageById(id);
    }

    /**
     * 查询产品碳足迹-产品阶段列表
     */
    @Override
    public List<ProductCarbonStage> selectProductCarbonStageList(ProductCarbonStage productCarbonStage)
    {
        return productCarbonStageMapper.selectProductCarbonStageList(productCarbonStage);
    }

    /**
     * 新增产品碳足迹-产品阶段
     */
    @Override
    public int insertProductCarbonStage(ProductCarbonStage productCarbonStage)
    {
        return productCarbonStageMapper.insertProductCarbonStage(productCarbonStage);
    }

    /**
     * 修改产品碳足迹-产品阶段
     */
    @Override
    public int updateProductCarbonStage(ProductCarbonStage productCarbonStage)
    {
        return productCarbonStageMapper.updateProductCarbonStage(productCarbonStage);
    }

    /**
     * 批量删除产品碳足迹-产品阶段
     */
    @Override
    public int deleteProductCarbonStageByIds(Long[] ids)
    {
        return productCarbonStageMapper.deleteProductCarbonStageByIds(ids);
    }

    /**
     * 删除产品碳足迹-产品阶段信息
     */
    @Override
    public int deleteProductCarbonStageById(Long id)
    {
        return productCarbonStageMapper.deleteProductCarbonStageById(id);
    }
}
